﻿@model IEnumerable<EShop.Models.Goods>
@helper Truncate(string input, int length)
    {
        if (input.Length <= length)
        {
    @input
        }
        else
        {
    @input.Substring(0, length)<text>...</text>
        }
}
@{
    ViewBag.Title = "Index";
}

<h2>浏览</h2>

<p>
    @Html.ActionLink("新建", "Create")
</p>
<table>
    <tr>
        <th>
            分类
        </th>
        <th>
            品牌
        </th>
        <th>
            名称
        </th>
        <th>
            价格
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Genre.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.brand.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Price)
        </td>
        <td>
            @Html.ActionLink("编辑", "Edit", new { id=item.GoodsId }) |
            @Html.ActionLink("详情", "Details", new { id=item.GoodsId }) |
            @Html.ActionLink("删除", "Delete", new { id=item.GoodsId })
        </td>
    </tr>
}

</table>
